import {Marker} from "react-amap";
import style from "./index.module.scss";



const MarkerBuilder = (props)=>{
    let {data:{markerPosition,info},history} = props;
    // console.log(markerPosition);
    // console.log(info);
    // console.log(history);
    // console.log("---------------");

    const markerEvents = {
        created: (markerInstance) => {
          console.log('高德地图 Marker 实例创建成功；如果你要亲自对实例进行操作，可以从这里开始。比如：');
          console.log(markerInstance.getPosition());
        },
        click:(e)=>{
            // console.log("markClick",e.target.w.position);
            console.log("markClick",e.target.w.extData);
            history.push({pathname:"/msg",state:{bid:e.target.w.extData.id}})
        }
    };

    return (
        // <Marker position={markerPosition} extData={info} clickable={true} events={markerEvents}>
        <Marker position={markerPosition} extData={info} clickable={true} events={markerEvents}>
            <div className={style["marker-content"]}>
                <img src={require("../../../common/image/map/mark_bs.png").default} />
                <img src={require("../../../common/image/book-cover-default.png").default} />
                <span>愚蠢的大多数</span>
            </div>
        </Marker>
    )
}

export default MarkerBuilder;

